<!--
 * 盲审申请上传文件开关控制
-->
<template>
  <div>
    <el-form :model="form" ref="form" label-suffix="：" :rules="rules" label-width="140px">
      <el-row :gutter="10">
        <el-col :span="24">
          <el-form-item :label="$t('label.college')" prop="academyCode">
            <el-select
              v-model="form.academyCode"
              style="width: 100%;"
              :clearable="false"
              filterable
              :placeholder="$t('common.text.all')"
              v-clearreadonly
            >
              <el-option
                  v-for="item in options.academyCode"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item :label="$t('paperBlindTrial.shortInstUploadFlag')" prop="shortInstUploadFlag">
            <span :class="form.shortInstUploadFlag==='Y'?'color_no':'color_yes'">{{$t('paperBlindTrial.switchOff')}}</span>
              <el-switch v-model="form.shortInstUploadFlag" active-color="#13ce66" active-value="Y" inactive-value="N"> </el-switch>
            <span :class="form.shortInstUploadFlag==='Y'?'color_yes':'color_no'">{{$t('paperBlindTrial.switchOn')}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item :label="$t('paperBlindTrial.selfAssUploadFlag')" prop="selfAssUploadFlag">
            <span :class="form.selfAssUploadFlag==='Y'?'color_no':'color_yes'">{{$t('paperBlindTrial.switchOff')}}</span>
              <el-switch v-model="form.selfAssUploadFlag" active-color="#13ce66" active-value="Y" inactive-value="N"> </el-switch>
            <span :class="form.selfAssUploadFlag==='Y'?'color_yes':'color_no'">{{$t('paperBlindTrial.switchOn')}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item :label="$t('paperBlindTrial.otherUploadFlag')" prop="otherUploadFlag">
            <span :class="form.otherUploadFlag==='Y'?'color_no':'color_yes'">{{$t('paperBlindTrial.switchOff')}}</span>
              <el-switch v-model="form.otherUploadFlag" active-color="#13ce66" active-value="Y" inactive-value="N"> </el-switch>
            <span :class="form.otherUploadFlag==='Y'?'color_yes':'color_no'">{{$t('paperBlindTrial.switchOn')}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="form_tips"><span style="color: red;">*</span>{{$t('paperBlindTrial.switchTips')}}</div>
  </div>
</template>

<script>
import { switchGetDetail, switchAddOrEdit } from "common/src/api/paperBlindTrial";
import commonMixins from 'common/src/views/practiceManagement/commonMixins';
export default {
    components: {
    },
    mixins: [commonMixins],
    props: {
      options: {
        type: Object
      }
    },
    data() {
      return {
        form: {
          academyCode: '',
          shortInstUploadFlag: 'Y',
          selfAssUploadFlag: 'Y',
          otherUploadFlag: 'Y'
        },
        rules: {
          academyCode: [
            {required: true, message: this.$t('common.pla.pleaseSelect'), trigger: 'change' },
          ]
        }
      };
    },
    computed: {

    },
    created() {
    },
    mounted() {
    },
    methods: {
      save(type) {
        this.$refs.form.validate((valid) => {
          if (valid) {
            switchAddOrEdit(this.form).then(res=> {
              if (res.code === 200) {
                this.$message.success(this.$t('message.addSuccess'));
                this.$emit('emit:back');
              }
            });
          }
        });
      }
    }
};
</script>

<style scoped lang="scss">
.color_no {
  color: #ccc;
  margin-right: 5px;
}
.color_yes {
  color: #222;
  margin-left: 5px;
}
.form_tips {
  font-size: 15px;
  color: #93A0AF;
  text-align: center;
}
</style>

